package com.klxedu.ms.gateway;

import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "service.authentication")
public class AuthServerProperties {

	private boolean captcha = false;

	private int maximumSessions = 1;

	private List<String> authenticateAction = new ArrayList<String>();

	private String resourceService;

	private String roleService;

	private int captchaSize = 4;

	private int captchaTimeout = 5000;
	
	private Csrf csrf;

	public boolean isCaptcha() {
		return captcha;
	}

	public void setCaptcha(boolean captcha) {
		this.captcha = captcha;
	}

	public int getMaximumSessions() {
		return maximumSessions;
	}

	public void setMaximumSessions(int maximumSessions) {
		this.maximumSessions = maximumSessions;
	}

	public List<String> getAuthenticateAction() {
		return authenticateAction;
	}

	public void setAuthenticateAction(List<String> authenticateAction) {
		this.authenticateAction = new ArrayList<String>(authenticateAction);
	}

	public String getResourceService() {
		return resourceService;
	}

	public void setResourceService(String resourceService) {
		this.resourceService = resourceService;
	}

	public String getRoleService() {
		return roleService;
	}

	public void setRoleService(String roleService) {
		this.roleService = roleService;
	}

	public int getCaptchaSize() {
		return captchaSize;
	}

	public void setCaptchaSize(int captchaSize) {
		this.captchaSize = captchaSize;
	}

	public int getCaptchaTimeout() {
		return captchaTimeout;
	}

	public void setCaptchaTimeout(int captchaTimeout) {
		this.captchaTimeout = captchaTimeout;
	}


	public Csrf getCsrf() {
		return csrf;
	}

	public void setCsrf(Csrf csrf) {
		this.csrf = csrf;
	}


	public static class Csrf {
		
		private List<String> ignoringAntMatchers;

		public List<String> getIgnoringAntMatchers() {
			return ignoringAntMatchers;
		}

		public void setIgnoringAntMatchers(List<String> ignoringAntMatchers) {
			this.ignoringAntMatchers = ignoringAntMatchers;
		}

	}
}
